﻿@model DDDSample.UI.Mvc.Models.CargoTrackingViewModel
@{
    ViewBag.Title = "Track your cargo";
}
@Html.ValidationSummary()
@using (Html.BeginForm())
{
    <div id="TrackingId">
        <span>
            <label for="trackingId">
                Enter your id:</label>
        </span><span>
            @Html.TextBox("id")
            @Html.ValidationMessage("id", "*")
        </span><span>
            <input type="submit" value="Track!" />
        </span>
    </div>
}
@if (Model != null)
{ 
    <div id="TrackingDetails">
        <h2>@Model.StatusText</h2>
        <p>Estimated time of arrival in @Model.Destination : @Model.Eta</p>
        <p>@Model.NextExpectedActivity</p>
        <h3>Handling History</h3>
        <ul style="list-style-type: none;">
            @foreach (var item in Model.HandlingEvents)
            { 
                <li>
                    <p>
                        @if (item.IsExpected)
                        {
                            <img style="vertical-align: top;" src="../../images/tick.png" alt="" />
                        }
                        else
                        {
                            <img style="vertical-align: top;" src="../../images/error.png" alt="" />
                        }
                        &nbsp;@item.Description
                    </p>
                </li>            
            }
        </ul>
        <p>@Html.ActionLink("Register new handling event", "RegisterHandlingEvent", "Handling", new { id = Model.Id }, null)</p>
    </div>
}